package org.future.esb;
/**
 *@date   2010-4-11 下午10:04:19
 *@author dycc
 *@file   org.future.esb.JmsConnector.java
 */
public class JmsConnector {
	private String tagName = "jms:activemq-connector";
	// not null
	private String attr_name = null;
	// not null
	private String attr_brokerURL = null;
	private int attr_maxRedelivery = 0;
	private boolean attr_cacheJmsSessions = false;
	// 1.1 , 1.0.2b
	private String attr_specification = "1.1";
	/**
	 * 校验
	 * @return
	 */
	public boolean validate(){
		boolean result = true;
		if(attr_name == null || attr_name.trim().equals("")){
			return false;
		}
		if(attr_brokerURL == null || attr_brokerURL.trim().equals("")){
			return false;
		}
		return result;
	}
	/**
	 * toString
	 */
	public String toString(){
		StringBuilder sb = new StringBuilder();
		sb.append("<" + tagName);
		sb.append(" name=\"" + getAttr_name() + "\"");
		sb.append(" brokerURL=\"" + getAttr_brokerURL() + "\"");
		sb.append(" maxRedelivery=\"" + getAttr_maxRedelivery() + "\"");
		sb.append(" cacheJmsSessions=\"" + getAttr_cacheJmsSessions() + "\"");
		sb.append(" specification=\"" + getAttr_specification() + "\"");
		sb.append(" >");
		sb.append("\r\n");
		sb.append("</" + tagName + ">");
		return sb.toString();
	}
	
	public String getTagName() {		
	    return tagName;
    }
	public void setTagName(String tagName) {
	    this.tagName = tagName;
    }
	
	public String getAttr_name() {
	    return attr_name;
    }
	public void setAttr_name(String attrName) {
	    attr_name = attrName;
    }
	
	public String getAttr_brokerURL() {
	    return attr_brokerURL;
    }
	public void setAttr_brokerURL(String attrBrokerURL) {
	    attr_brokerURL = attrBrokerURL;
    }
	
	public int getAttr_maxRedelivery() {
	    return attr_maxRedelivery;
    }
	public void setAttr_maxRedelivery(int attrMaxRedelivery) {
	    attr_maxRedelivery = attrMaxRedelivery;
    }
	
	public boolean getAttr_cacheJmsSessions() {
	    return attr_cacheJmsSessions;
    }
	public void setAttr_cacheJmsSessions(boolean attrCacheJmsSessions) {
	    attr_cacheJmsSessions = attrCacheJmsSessions;
    }
	
	public String getAttr_specification() {
	    return attr_specification;
    }
	public void setAttr_specification(String attrSpecification) {
	    attr_specification = attrSpecification;
    }
}
